package com.rayboo.example.design.pattern.bridge;

/**
 * 桥接模式
 * http://c.biancheng.net/view/1364.html
 */
public class Main {

    public static void main(String[] args) {
        // 准备好杯子和添加物
        Cup largeCup = new LargeCup();
        Cup smallCup = new SmallCup();
        Additive sugar = new SugarAdditive();
        Additive matcha = new matchaAdditive();

        CoffeeMaker maker = new CoffeeMaker();
        Coffee largeSugar = maker.makeCoffee(largeCup, sugar);
        Coffee largeMatcha = maker.makeCoffee(largeCup, matcha);

        Coffee smallSugar = maker.makeCoffee(smallCup, sugar);
        Coffee smallMatcha = maker.makeCoffee(smallCup, matcha);

        System.out.println(largeSugar
                + "\n" + largeMatcha
                + "\n" + smallSugar
                + "\n" + smallMatcha);

        // 支持中杯
        Cup middleCup = new MiddleCup();
        Coffee middleSugar = maker.makeCoffee(middleCup, sugar);
        Coffee middleMatcha = maker.makeCoffee(middleCup, matcha);
        System.out.println(middleSugar
                + "\n" + middleMatcha);
    }
}
